package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class PaymentController {
    @Resource
    PaymentService paymentService;

    @Value("${server.port}")
    String servePort;

    @GetMapping("/payment/hystrix/ok/{id}")
    public String payment_ok(@PathVariable("id") Integer id) {
        String ok = paymentService.paymentInfo_ok(id);
        return ok;
    }


    @GetMapping("/payment/hystrix/timeout/{id}")
    public String payment_false(@PathVariable("id") Integer id) {
        String ok = paymentService.paymentInfo_timeout(id);
        return ok;
    }
}
